import React, { Component } from "react";
import { Table, Button } from "antd";
class Remote extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  render() {
    const rowSelection = {
      onChange: (selectedRowKeys, selectedRows) => {
        console.log(
          `selectedRowKeys: ${selectedRowKeys}`,
          "selectedRows: ",
          selectedRows
        );
      },
      getCheckboxProps: (record) => ({
        name: record.name,
      }),
    };
    const dataSource = [
      {
        key: "1",
        name: "navit.exe",
        time: "2021-11-15/7:50:42",
        trust: "不可信",
      },
      {
        key: "2",
        name: "baidu.exe",
        time: "2021-11-16/8:43:12",
        trust: "不可信",
      },
      {
        key: "3",
        name: "wangyi.exe",
        time: "2021-11-17/7:08:33",
        trust: "不可信",
      },
      {
        key: "4",
        name: "zhifu.exe",
        time: "2021-11-18/9:46:24",
        trust: "不可信",
      },
      {
        key: "5",
        name: "ccc.exe",
        time: "2021-11-19/10:50:42",
        trust: "不可信",
      },
    ];

    const columns = [
      {
        title: "文件名",
        dataIndex: "name",
        key: "name",
      },
      {
        title: "上传日期",
        dataIndex: "time",
      },
      {
        title: "信任状态",
        dataIndex: "trust",
      },
      {
        title: "操作",
        dataIndex: "operation",
        render: () => (
          <div>
            <Button type="primary">添加</Button>&nbsp;&nbsp;
            <Button type="primary">详情</Button>&nbsp;&nbsp;
            <Button type="primary">删除</Button>
          </div>
        ),
      },
    ];
    return (
      <div style={{ float: "left", width: "80%" }}>
        <Table
          dataSource={dataSource}
          columns={columns}
          rowSelection={rowSelection}
        />
        <Button type="primary">信任全部</Button>&nbsp;&nbsp;
        <Button type="primary">信任选中</Button>&nbsp;&nbsp;
        <Button type="primary">删除选中</Button>&nbsp;&nbsp;
        <Button type="primary">全部删除</Button>
      </div>
    );
  }
}

export default Remote;
